<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">Simple Module <i>CSMA802154</i></h2>
<b>Package:</b> org.mixim.modules.mac<br/><b>File: <a href="modules-mac-CSMA802154.ned.html">modules/mac/CSMA802154.ned</a></b><br/><p><a href="../doxy/a00025.html" target="mainframe"><b>C++ definition</b></a></p>

<p>IEEE 802.15.4-2006 non-beacon enabled CSMA protocol
This model was independently validated on a wireless sensor network testbed.
For more information, see 
Accurate Timeliness Simulations for Real-Time Wireless Sensor Networks,
J. Rousselot, J.-D. Decotignie, M. Aoun, P. van der Stok, R. Serna Oliver,
G. Fohler. In Proceedings of the 2009 Third UKSim European Symposium on Computer 
Modeling and Simulation. </p>
<p>http://dx.doi.org/10.1109/EMS.2009.34</p>
<img src="org.mixim.modules.mac.CSMA802154-type.png" ismap="yes" usemap="#type-diagram"/><map name="type-diagram">
<area shape="rect" href="org.mixim.modules.mac.CSMA802154.html" title="CSMA802154" alt="CSMA802154" coords="0,0,129,40">
</map>
<h3 class="subtitle">Usage diagram:</h3>
<p>The following diagram shows usage relationships between types.
Unresolved types are missing from the diagram. Click <a href="full-ned-usage-diagram.html">here</a> to see the full picture.</p>
<img src="org.mixim.modules.mac.CSMA802154-usage.png" ismap="yes" usemap="#usage-diagram"/><map name="usage-diagram"><area shape="rect" id="node1" href="org.mixim.modules.mac.CSMA802154.html" title="Simple Module CSMA802154" alt="" coords="124,83,225,111">
<area shape="rect" id="node2" href="org.mixim.modules.nic.Nic802154_TI_CC1100.html" title="Compound Module Nic802154_TI_CC1100" alt="" coords="5,6,163,34">
<area shape="rect" id="node4" href="org.mixim.modules.nic.Nic802154_TI_CC2420.html" title="Compound Module Nic802154_TI_CC2420" alt="" coords="187,6,344,34">
</map>
<h3 class="subtitle">Inheritance diagram:</h3>
<p>The following diagram shows inheritance relationships for this type.
Unresolved types are missing from the diagram. Click <a href="full-ned-inheritance-diagram.html">here</a> to see the full picture.</p>
<img src="org.mixim.modules.mac.CSMA802154-inheritance.png" ismap="yes" usemap="#inheritance-diagram"/><map name="inheritance-diagram"><area shape="rect" id="node1" href="org.mixim.modules.mac.CSMA802154.html" title="Simple Module CSMA802154" alt="" coords="5,83,107,111">
<area shape="rect" id="node2" href="org.mixim.modules.mac.csma.html" title="Simple Module csma" alt="" coords="20,6,92,34">
</map>
<h3 class="subtitle">Extends:</h3>
<table>
<tr>
   <td>
      <a href="org.mixim.modules.mac.csma.html">csma</a>
      <i> (simple&nbsp;module)</i>
   </td>
   <td>

<p>Generic CSMA protocol supporting Mac-ACKs as well as
constant, linear or exponential backoff times.</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Used in compound modules:</h3>
<p>If a module type shows up more than once, that means it has been defined in more than one NED file.</p>
<table>
<tr>
   <td>
      <a href="org.mixim.modules.nic.Nic802154_TI_CC1100.html">Nic802154_TI_CC1100</a>
      <i> (compound&nbsp;module)</i>
   </td>
   <td>

<p>This NIC implements a TI CC1100 network interface card
using the CSMA protocol as specified in IEEE 802.15.4-2006.</p>
   </td>
</tr>
<tr>
   <td>
      <a href="org.mixim.modules.nic.Nic802154_TI_CC2420.html">Nic802154_TI_CC2420</a>
      <i> (compound&nbsp;module)</i>
   </td>
   <td>

<p>This NIC implements a Texas Instruments CC 2420 802.15.4 network interface card
using the CSMA protocol as specified in IEEE 802.15.4-2006.</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Parameters:</h3>
<table class="paramtable">
   <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Default value</th>
      <th>Description</th>
   </tr>
<tr class="inherited">
   <td width="150">notAffectedByHostState</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">false</td>
   <td>
   </td>
</tr>
<tr class="inherited">
   <td width="150">coreDebug</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120"></td>
   <td>
<p>debug switch</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">headerLength</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">72 bit</td>
   <td>
<p>length of the MAC packet header (in bits)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">debug</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">false</td>
   <td>
<p>debug switch</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">stats</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">true</td>
   <td>   </td>
</tr>
<tr class="inherited">
   <td width="150">trace</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">false</td>
   <td>
   </td>
</tr>
<tr class="inherited">
   <td width="150">queueLength</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">100</td>
   <td>
<p>size of the MAC queue (maximum number of packets in Tx buffer)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">bitrate</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">250000 bps</td>
   <td>
<p>bit rate</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">ccaDetectionTime</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">0.000128 s</td>
   <td>
<p>Clear Channel Assessment detection time</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">rxSetupTime</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>Time to setup radio to reception state</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">aTurnaroundTime</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">0.000192 s</td>
   <td>
<p>Time to switch radio from Rx to Tx state</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">txPower</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>tx power [mW]</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">useMACAcks</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">true</td>
   <td>
<p>Send/Expect MAC acks for unicast traffic?</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">macMaxFrameRetries</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">3</td>
   <td>
<p>maximum number of frame retransmission
only used when usage of MAC acks is enabled</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">macAckWaitDuration</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">0.00056 s</td>
   <td>
<p>time to wait for an acknowledgement after transmitting a unicast frame.
only used when usage of MAC acks is enabled</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">ackLength</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">40 bit</td>
   <td>
<p>complete MAC ack message length (in bits) 
(! headerLength is not added to this)
only used when usage of MAC acks is enabled</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">sifs</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">0.000192 s</td>
   <td>
<p>simple interframe space. Time to wait between receiving a frame and acknowledging it.
Should be bigger than the maximum time for switching between Tx and Rx at the receiver.
only used when usage of MAC acks is enabled</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">backoffMethod</td>
   <td width="100">
      <i>string</i>
   </td>
   <td width="120">"exponential"</td>
   <td>
<p>backoff method to use: constant, linear or exponential</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">macMaxCSMABackoffs</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">4</td>
   <td>
<p>maximum backoffs</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">aUnitBackoffPeriod</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">0.00032 s</td>
   <td>
<p>base unit for all backoff calculations</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">contentionWindow</td>
   <td width="100">
      <i>int</i>
   </td>
   <td width="120">2</td>
   <td>
<p># of backoff periods of the initial contention window
(for linear and constant backoff method only)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">macMinBE</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">3</td>
   <td>
<p>minimum backoff exponent (for exponential backoff method only)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">macMaxBE</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120">5</td>
   <td>
<p>maximum backoff exponent (for exponential backoff method only)</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Properties:</h3>
<table class="paramtable">
   <tr>
      <th>Name</th>
      <th>Value</th>
      <th>Description</th>
   </tr>
<tr>
   <td width="150">class</td>
   <td width="100"><i>CSMA802154</i></td>
   <td>
</td>
</tr>
</table>
<h3 class="subtitle">Gates:</h3>
<table class="paramtable">
   <tr>
      <th>Name</th>
      <th>Direction</th>
      <th>Size</th>
      <th>Description</th>
   </tr>
<tr class="inherited">
   <td width="150">upperGateIn</xsl:if></td>
   <td width="100"><i>input</i></td>
   <td width="50"></td>   <td>
<p>from upper layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">upperGateOut</xsl:if></td>
   <td width="100"><i>output</i></td>
   <td width="50"></td>   <td>
<p>to uppe layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">upperControlIn</xsl:if></td>
   <td width="100"><i>input</i></td>
   <td width="50"></td>   <td>
<p>control from upper layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">upperControlOut</xsl:if></td>
   <td width="100"><i>output</i></td>
   <td width="50"></td>   <td>
<p>control to upper layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">lowerGateIn</xsl:if></td>
   <td width="100"><i>input</i></td>
   <td width="50"></td>   <td>
<p>from lower layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">lowerGateOut</xsl:if></td>
   <td width="100"><i>output</i></td>
   <td width="50"></td>   <td>
<p>to lower layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">lowerControlIn</xsl:if></td>
   <td width="100"><i>input</i></td>
   <td width="50"></td>   <td>
<p>control from lower layer</p>
</td>
</tr>
<tr class="inherited">
   <td width="150">lowerControlOut</xsl:if></td>
   <td width="100"><i>output</i></td>
   <td width="50"></td>   <td>
<p>control to lower layer</p>
</td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #808080; font-style: italic; ">//
// IEEE 802.15.4-2006 non-beacon enabled CSMA protocol
// This model was independently validated on a wireless sensor network testbed.
// For more information, see 
// Accurate Timeliness Simulations for Real-Time Wireless Sensor Networks,
// J. Rousselot, J.-D. Decotignie, M. Aoun, P. van der Stok, R. Serna Oliver,
// G. Fohler. In Proceedings of the 2009 Third UKSim European Symposium on Computer 
// Modeling and Simulation. 
//
// http://dx.doi.org/10.1109/EMS.2009.34
// 
</span><span style="color: #800000; font-weight: bold; ">simple</span><span style="color: #000000; "> </span><span style="color: #000000; ">CSMA802154</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">extends</span><span style="color: #000000; "> </span><span style="color: #000000; ">csma</span><span style="color: #000000; ">
{
    </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
        </span><span style="color: #000000; font-weight: bold; ">@class</span><span style="color: #000000; ">(</span><span style="color: #000000; ">CSMA802154</span><span style="color: #000000; ">);

        </span><span style="color: #000000; ">sifs</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000192</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// 12 symbols
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">headerLength</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">bit</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">72</span><span style="color: #000000; "> </span><span style="color: #000000; ">bit</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">queueLength</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">100</span><span style="color: #000000; ">);
        </span><span style="color: #000000; ">bitrate</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">bps</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">250000</span><span style="color: #000000; "> </span><span style="color: #000000; ">bps</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">ackLength</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">bit</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">40</span><span style="color: #000000; "> </span><span style="color: #000000; ">bit</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">macMaxCSMABackoffs</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">4</span><span style="color: #000000; ">);  </span><span style="color: #808080; font-style: italic; ">// takes values between 0 and 5  
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">macMaxFrameRetries</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">3</span><span style="color: #000000; ">);  </span><span style="color: #808080; font-style: italic; ">// takes values between 0 and 7
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">macAckWaitDuration</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">00056</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;  </span><span style="color: #808080; font-style: italic; ">// 1+12+10+12 symbols
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">ccaDetectionTime</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000128</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// 8 symbols
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">aTurnaroundTime</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000192</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;    </span><span style="color: #808080; font-style: italic; ">// 12 symbols
</span><span style="color: #000000; ">        </span><span style="color: #808080; font-style: italic; ">//txPower @unit(mW);
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">useMACAcks</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">true</span><span style="color: #000000; ">);

        </span><span style="color: #000000; ">backoffMethod</span><span style="color: #000000; "> = </span><span style="color: #008000; ">&quot;exponential&quot;</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">aUnitBackoffPeriod</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">00032</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">macMaxBE</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">5</span><span style="color: #000000; ">);	</span><span style="color: #808080; font-style: italic; ">// takes values between 3 and 8
</span><span style="color: #000000; ">        </span><span style="color: #000000; ">macMinBE</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">3</span><span style="color: #000000; ">);	</span><span style="color: #808080; font-style: italic; ">// takes values between 0 and macMaxBE
</span><span style="color: #000000; ">}
</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
